package com.miku.screens;

import com.miku.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;

public class SplashScreen extends Activity {
	
	private Thread splashThread;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        setContentView(R.layout.splashscreen);
        
        splashThread = new Thread(){
        	@Override
        	public void run(){
        		try{
        			synchronized(this){
        				wait(5000);
        			}
        		}catch(InterruptedException ex){
        		}
        		
        		finish();
        		
        		// Run next activity
                Intent intent = new Intent();
                intent.setClass(SplashScreen.this, LoginActivity.class);
                startActivity(intent);
                //stop(); 
        	}
        };
        splashThread.start();  
    }
    
    /**
     * Processes splash screen touch events
     */
    @Override
    public boolean onTouchEvent(MotionEvent evt)
    {
        if(evt.getAction() == MotionEvent.ACTION_DOWN)
        {
            synchronized(splashThread){
                splashThread.notifyAll();
            }
        }
        return true;
    }
}